package com.asifrc.tw101;

/**
 * Created by asifrc on 2/11/14.
 */
public class Line {
    protected String point = "*";
    protected String padding = " ";
    private String contents = "";

    public Line(int n) {
        addPoints(n);
    }

    public Line(String text) {
        contents = text;
    }

    private void addPoints(int n) {
        StringBuilder points = new StringBuilder();
        for (int i = 0; i < n; i++) {
            points.append(point);
        }
        contents = points.toString();
    }

    public void pad(int n) {
        StringBuilder pre = new StringBuilder();
        for (int i = 0; i < n; i++) {
            pre.append(padding);
        }
        pre.append(contents);
        contents = pre.toString();
    }

    @Override
    public String toString() {
        return contents+"\n";
    }
}
